Skip to content

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Oct 5, 2025

No description provided.

@Girgias Girgias marked this pull request as ready for review October 5, 2025 12:59
@Girgias Girgias requested a review from devnexen as a code owner October 5, 2025 12:59
Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed. just need an UPGRADING entry and we re good.

Comment on lines +9 to +16
try {
var_dump(imagefilter($image, -1));
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
ValueError: imagefilter(): Argument #2 ($filter) must be one of the IMG_FILTER_* filter constants

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks a lot for the fix! I just have two suggestions:

  1. I think we can remove the var_dump as it's not necessary.
  2. I believe the current test only checks that the value isn't less than the minimum allowed filter, but it doesn't test that it isn't greater than the maximum allowed filter. The fix should address that, so it might be worth adding a test for that case as well.

Thanks again for the fix!

Suggested change
try {
var_dump(imagefilter($image, -1));
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
ValueError: imagefilter(): Argument #2 ($filter) must be one of the IMG_FILTER_* filter constants
try {
imagefilter($image, -1);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
imagefilter($image, 999);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
ValueError: imagefilter(): Argument #2 ($filter) must be one of the IMG_FILTER_* filter constants
ValueError: imagefilter(): Argument #2 ($filter) must be one of the IMG_FILTER_* filter constants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ext/gd: Return type violation in imagefilter when an invalid filter is provided
3 participants